package com.sanyang.lawyer.controller.Statistics;

import com.sanyang.lawyer.entity.HrFlexigrid;
import com.sanyang.lawyer.service.Audit.AuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @program: lawyer
 * @description: 用印统计控制层
 * @author: Mis.Feng
 * @create: 2019-11-01 08:23
 **/

@RestController
@RequestMapping("usingStatistical")
public class UsingStatisticalController {
    @Autowired
    private AuditService as;

    @RequestMapping("listAudit")
    public Map<String,Object> listAudit(HttpServletRequest request){
        Map map1 = initMap(request);
        HrFlexigrid hrFlexigrid=new HrFlexigrid(map1,request);
        map1.put("Flexigrid",hrFlexigrid);
        List<Map<String, Object>> list = as.listStatistical(map1);
        Integer count=as.listcount(map1);
        Map<String,Object> map=new HashMap<>();
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", count);
        map.put("data", list);
        return map;
    }
    public Map<String, Object> initMap(HttpServletRequest request) {
        String empId=request.getParameter("empId");
        String time1=request.getParameter("time1");
        String time2=request.getParameter("time2");
        String state=request.getParameter("state");
        String sealType=request.getParameter("sealType");
        Map<String, Object> map = new HashMap();
        map.put("empId",empId);
        map.put("time1",time1);
        map.put("time2",time2);
        map.put("state",state);
        map.put("sealType",sealType);
        return map;
    }}
